<template>
  <div class="product-details">
    <Header></Header>
    <div class="content">
        <h3>{{this.productDetailsList.title}}</h3>
        <p>{{this.productDetailsList.created_at}}</p>
        <span></span>
        <div v-html="this.productDetailsList.body" class="words">
        </div>
        <div class="download" v-show="dowloadShow">
              <a :href="this.dowloadShow" target="blank">
                <img src="../../../static/img/dowload.jpg" alt="产品下载图标">
              </a>
        </div>
    </div>
    <div class="fixeds" v-show="topShow" ref="viewBox">
            <a href="#">
                <img src="../../../static/img/back-top.png" alt="">
            </a>
    </div>
    <Interactive></Interactive>
  </div>
</template>
<script>
import Header from '../productVideo/components/Header'
import Interactive from '../interactive/Interactive'
export default {
  name: 'ProductDetails',
  data(){
      return {
          productDetailsList: [],
          id: null,
          dowloadShow: null,
          topShow:true
      }
  },
  components: {
      Header,
      Interactive
  },
  created(){
      this.getId();
      this.axios.get('/articles/' + this.id,{
          params: {
              id: this.id
          }
      })
      .then((res) => {
          this.productDetailsList = res.data.data;
          this.dowloadShow = res.data.data.doc_url;
          console.log(this.dowloadShow);
      })
      .catch((error) => {
          console.log(error);
      })
  },
  methods:{
        getId(){
            this.id = this.$route.params.id;
        }
  }
}
</script>
<style scoped>
.product-details{
    width: 100%;
    height: auto;
}
.product-details .content{
    width: 6.7rem;
    height: auto;
    margin-left: .4rem;
    margin-top: .2rem;
    padding-bottom: 1rem; 
}
.product-details .content h3{
    font-size: 16px;
    color: #333;
    width: 100%;
    text-align: center;
    height: .4rem;
    overflow: hidden;
}
.product-details .content p{
    width: 100%;
    text-align: center;
    margin-top: .2rem;
    font-size: 12px;
    color: #ccc;
}
.product-details .content span{
    width: 100%;
    border-bottom: .02rem solid #e8e8e8;
    display: inline-block;
    margin-top: .2rem;
}
.product-details .content .words{
    margin-top: .2rem;
    font-size: 14px;
}
.product-details .content .words img{
    width: 100%;
    height: auto;
}
.product-details .fixeds{
    width: .7rem;
    height: .7rem;
    position: fixed;
    bottom: 3rem;
    right: .2rem;
}
.product-details .fixeds img{
    width: 100%;
    height: auto;
}
.product-details .download{
    width: 2rem;
    height: .7rem;
    margin-left: 4.4rem;
    margin-bottom: 1.5rem;
}
.product-details .download img{
    width: 100%;
    height: .7rem;
}
</style>
<style>
.product-details .content .words img{
    width: 100%;
    height: auto;
}
</style>
